import wordcloud
import numpy as np
from PIL import Image
picture = Image.open("wzk.png")
mk = np.array(picture)
w = wordcloud.WordCloud(font_path='AdobeHeitiStd-Regular.otf',mask=mk,
                        max_words=500,background_color='white')
with open('xiyouji.txt',encoding='utf-8') as file1:
 string = file1.read()
w.generate(string)
w.to_file('xiyou3.jpg')